package interfaces;
import java.util.ArrayList;

/**
 * @author chihb
 * @create-time 2024/6/28 21:21
 * @description
 */
public class StudentOpIml1 implements StudentOpearter{

    @Override
    public void printAllINfo(ArrayList<Student> students) {
        System.out.println("==========打印全部的学生对象==========");
        for(int i=0;i<students.size();i++){
            Student s=students.get(i);
            System.out.println("姓名："+s.getName()+",性别："+s.getSex()+",成绩："+s.getScore());
        }
    }

    @Override
    public void printScore(ArrayList<Student> students) {
        System.out.println("==========打印全部的学生对象==========");
        Double sum=0.0;
        for(int i=0;i<students.size();i++){
            Student s=students.get(i);
            sum+=s.getScore();
        }
        System.out.println("平均成绩为:"+sum/students.size());
    }
}
